import java.util.Scanner;

public class Main {
    public static void hanoi(int n,char a,char b,char c) {
    //a=源柱，b=辅助柱，c=目标柱
        if(n==1) {
            System.out.println("移动第1个盘子从"+a+"移动到"+c);
            return;
        }
        hanoi(n-1,a,c,b);
        System.out.println("第"+n+"个盘子从"+a+"移动到"+c);
        hanoi(n-1,b,a,c);
    }
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        hanoi(n,'A','B','C');
    }
}